package com.twu.biblioteca;

/**
 * Created by dmortime on 12/03/2014.
 */
public class MainMenuWithoutLoggedInCustomer implements IMenu {
    private OutputWriter outputWriter;
    private InputReader inputReader;
    private Library library;

    public MainMenuWithoutLoggedInCustomer(OutputWriter outputWriter, InputReader inputReader, Library library) {
        this.outputWriter = outputWriter;
        this.inputReader = inputReader;
        this.library = library;
    }

    public void display() {
        outputWriter.writeLines(
                "Please select one of the following options:",
                "(L)ist available books",
                "Log (i)n",
                "(E)xit",
                "",
                "(Enter one of the characters shown in parentheses)"
        );
    }

    public IMenu nextMenu() {
        String input = inputReader.getInput();
        if(input.equals("l")) {
            return new ListAvailableBooksMenu(outputWriter, inputReader, library, null);
        } else if(input.equals("i")) {
            return new LogInMenu(outputWriter, inputReader, library);
        } else return null;
    }
}
